<?php

/**
 * Tagger Plugin for Frog CMS <http://thehub.silentworks.co.uk/plugins/frog-cms/tagger>
 * Alternate Mirror site <http://www.tbeckett.net/articles/plugins/tagger.xhtml>
 * Copyright (C) 2008 Andrew Smith <a.smith@silentworks.co.uk>
 * Copyright (C) 2008 Tyler Beckett <tyler@tbeckett.net>

 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.

 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

Plugin::setInfos(array(
    'id'          => 'organize',
    'title'       => 'Organize',
    'description' => 'Categories plugin to organise your website.',
    'version'     => '0.1.0',
    'license'     => 'AGPL',
    'author'      => 'Andrew Smith',
    'website'     => 'http://thehub.silentworks.co.uk/plugins/frog-cms/organize',
	'update_url'  => 'http://thehub.silentworks.co.uk/plugin-version.xml',
    'require_frog_version' => '0.9.5')
);

Observer::observe('view_page_edit_tabs', 'organize_in_page');


// Include Model
include_once "models/Organize.php";

function organize_in_page() {
	$organize = new Organize;
	include_once "includes/organize_in_page.php";
}

function segment($arg, $reverse = FALSE) {
	$segment = explode('/', $_SERVER['REQUEST_URI']);
	if($reverse) { $segment = array_reverse($segment); }
	return $segment;
}

function debug($data) {
	if(is_array($data)) {
		echo "<pre>";
			var_dump($data);
		echo "</pre>";
	} else {
		echo "<pre style='background-color: red'>" . $data . "</pre>";
	}
}